package com.sisreq.telas;

import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
import com.sisreq.elementos.*;

@SuppressWarnings("serial")
public class CadastroDepartamento extends JPanel {
	private MyLabel nomeDepartamentoLabel;
	private MyTextField nomeDepartamentoCampo;
	private MyButton novoCadastroButton, limparInfoButton;
	
	public CadastroDepartamento(){
		this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		this.add(Box.createVerticalGlue());
		JPanel conteudoCentral = new JPanel();
		GroupLayout layout = new GroupLayout(conteudoCentral);
		conteudoCentral.setLayout(layout);
		layout.setAutoCreateGaps(true);
		layout.setAutoCreateContainerGaps(true);
		
		nomeDepartamentoLabel = new MyLabel("Departamento: ");
		nomeDepartamentoCampo = new MyTextField(10);
		novoCadastroButton = new MyButton("Cadastrar");
		limparInfoButton = new MyButton("Limpar");
		
		GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup();
		hGroup.addGroup(layout.createParallelGroup().addComponent(nomeDepartamentoLabel).addComponent(novoCadastroButton));
		hGroup.addGroup(layout.createParallelGroup().addComponent(nomeDepartamentoCampo).addComponent(limparInfoButton));
		layout.setHorizontalGroup(hGroup);
		
		GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup();
		vGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(nomeDepartamentoLabel).addComponent(nomeDepartamentoCampo));
		vGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(novoCadastroButton).addComponent(limparInfoButton));
		layout.setVerticalGroup(vGroup);

		this.add(Box.createVerticalGlue());
		this.add(conteudoCentral);
	}
	
}
